# -*- coding: utf-8 -*-
N=int(raw_input())
scores = map(int, raw_input().split(' '))
count_dict = {}
for i in range(101):
    count_dict[i]=0
for e in scores:
    count_dict[e]+=1

K_K_Scores = map(int, raw_input().split(' '))
K = K_K_Scores[0]
kscores = K_K_Scores[1:]
kres = []
for e in kscores:
    kres.append(count_dict[e])
print ' '.join(map(str,kres))